package no.ntnu.fp.handlers;

import java.util.List;

import no.ntnu.fp.handler.Handler;
import no.ntnu.fp.messages.Message;
import no.ntnu.fp.messages.impl.MeetingsForEmployeeMessage;
import no.ntnu.fp.model.CalendarModel;
import no.ntnu.fp.model.Employee;
import no.ntnu.fp.model.Meeting;

public class MeetingsForEmployeeHandler implements Handler {
	private final CalendarModel calendarModel;
	
	public MeetingsForEmployeeHandler(CalendarModel calendarModel) {
		this.calendarModel = calendarModel;
	}

	@Override
	public void handleMessage(Message message) {
		MeetingsForEmployeeMessage meetingsForEmployeeMessage 
										= (MeetingsForEmployeeMessage) message;
		
		Employee employee = meetingsForEmployeeMessage.getEmployee();
		List<Meeting> meetings = meetingsForEmployeeMessage.getMeetings();
		calendarModel.setMeetingsForEmployee(employee, meetings);
	}
}
